<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	template="../templates/ui.xhtml">
    
    <ui:define name="head">
        <style type="text/css">
            .ui-tree {
                width: 300px;
            }
        </style>
    </ui:define>

	<ui:define name="content">
		<h1 class="title ui-widget-header ui-corner-all">Tree - Icons</h1>

		<div class="entry">
			<p>Each node in a tree can have a specific icon.</p>

			<h:form id="form">

                <p:tree id="docTree" value="#{documentsController.root}" var="doc">
					<p:treeNode expandedIcon="ui-icon-folder-open" collapsedIcon="ui-icon-folder-collapsed">
						<h:outputText value="#{doc.name}"/>
					</p:treeNode>

					<p:treeNode type="document" icon="ui-icon-document">
						<h:outputText value="#{doc.name}" />
					</p:treeNode>

					<p:treeNode type="picture" icon="ui-icon-image">
						<h:outputText value="#{doc.name}" />
					</p:treeNode>

					<p:treeNode type="mp3" icon="ui-icon-video">
						<h:outputText value="#{doc.name}" />
					</p:treeNode>
				</p:tree>

			</h:form>

			<h3>Source</h3>
			<p:tabView>
				<p:tab title="treeIcons.xhtml">
			<pre name="code" class="xml">
&lt;h:form id="form"&gt;

    &lt;p:tree id="docTree" value="\#{documentsController.root}" var="doc"&gt;
        &lt;p:treeNode expandedIcon="ui-icon-folder-open"
                    collapsedIcon="ui-icon-folder-collapsed"&gt;
            &lt;h:outputText value="\#{doc.name}"/&gt;
        &lt;/p:treeNode&gt;

        &lt;p:treeNode type="document" icon="ui-icon-document"&gt;
            &lt;h:outputText value="\#{doc.name}" /&gt;
        &lt;/p:treeNode&gt;

        &lt;p:treeNode type="picture" icon="ui-icon-image"&gt;
            &lt;h:outputText value="\#{doc.name}" /&gt;
        &lt;/p:treeNode&gt;

        &lt;p:treeNode type="mp3" icon="ui-icon-video"&gt;
            &lt;h:outputText value="\#{doc.name}" /&gt;
        &lt;/p:treeNode&gt;
    &lt;/p:tree&gt;

&lt;/h:form&gt;
			</pre>
				</p:tab>

				<p:tab title="DocumentsController.java">
                    <pre name="code" class="java">
package org.primefaces.examples.view;

import java.io.Serializable;

import org.primefaces.model.DefaultTreeNode;
import org.primefaces.model.TreeNode;

import org.primefaces.examples.domain.Document;

public class DocumentsController implements Serializable {

	private TreeNode root;

    public DocumentsController() {
		root = new DefaultTreeNode("root", null);

		TreeNode documents = new DefaultTreeNode(new Document("Documents", "-", "Folder"), root);
		TreeNode pictures = new DefaultTreeNode(new Document("Pictures", "-", "Folder"), root);
		TreeNode movies = new DefaultTreeNode(new Document("Movies", "-", "Folder"), root);

		TreeNode work = new DefaultTreeNode(new Document("Work", "-", "Folder"), documents);
		TreeNode primefaces = new DefaultTreeNode(new Document("PrimeFaces", "-", "Folder"), documents);

		//Documents
		TreeNode expenses = new DefaultTreeNode("document", new Document("Expenses.doc", "30 KB", "Word Document"), work);
		TreeNode resume = new DefaultTreeNode("document", new Document("Resume.doc", "10 KB", "Word Document"), work);
		TreeNode refdoc = new DefaultTreeNode("document", new Document("RefDoc.pages", "40 KB", "Pages Document"), primefaces);

		//Pictures
		TreeNode barca = new DefaultTreeNode("picture", new Document("barcelona.jpg", "30 KB", "JPEG Image"), pictures);
		TreeNode primelogo = new DefaultTreeNode("picture", new Document("logo.jpg", "45 KB", "JPEG Image"), pictures);
		TreeNode optimus = new DefaultTreeNode("picture", new Document("optimusprime.png", "96 KB", "PNG Image"), pictures);

		//Movies
		TreeNode pacino = new DefaultTreeNode(new Document("Al Pacino", "-", "Folder"), movies);
		TreeNode deniro = new DefaultTreeNode(new Document("Robert De Niro", "-", "Folder"), movies);

		TreeNode scarface = new DefaultTreeNode("mp3", new Document("Scarface", "15 GB", "Movie File"), pacino);
		TreeNode carlitosWay = new DefaultTreeNode("mp3", new Document("Carlitos' Way", "24 GB", "Movie File"), pacino);

		TreeNode goodfellas = new DefaultTreeNode("mp3", new Document("Goodfellas", "23 GB", "Movie File"), deniro);
		TreeNode untouchables = new DefaultTreeNode("mp3", new Document("Untouchables", "17 GB", "Movie File"), deniro);
	}

	public TreeNode getRoot() {
		return root;
	}
}
                    </pre>
				</p:tab>
			</p:tabView>




		</div>

	</ui:define>
</ui:composition>